package NewTablePanels;

import javax.swing.*;

public class NewAirplaneTable extends JPanel {
	
	private JPanel leftPart;
	private JPanel rightPart;
	
	private JLabel modelLabel;
	private JLabel planeIDLabel;
	private JLabel dateBuiltLabel;
	private JLabel companyLabel;
	
	private JTextField modelField;
	private JTextField planeIDField;
	private JTextField dateBuiltField;
	private JTextField companyField;
	
	public NewAirplaneTable()
	{
		modelLabel = new JLabel("Model: ");
		planeIDLabel = new JLabel("Plane-ID: ");
		dateBuiltLabel = new JLabel("Date of Build: ");
		companyLabel = new JLabel("Company: ");
		
		modelField = new JTextField(20);
		planeIDField = new JTextField(20);
		dateBuiltField = new JTextField(20);
		companyField = new JTextField(20);
		
		leftPart = new JPanel();
		rightPart = new JPanel();
		
		leftPart.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
		rightPart.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
		
		fillLeftPart();
		fillRightPart();
		
		this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
		this.add(leftPart);
		this.add(rightPart);
		this.setVisible(false);
	}
	
	private void fillLeftPart()
	{
		leftPart.add(modelLabel);
		leftPart.add(planeIDLabel);
		leftPart.add(dateBuiltLabel);
		leftPart.add(companyLabel);
	}
	
	private void fillRightPart()
	{
		rightPart.add(modelField);
		rightPart.add(planeIDField);
		rightPart.add(dateBuiltField);
		rightPart.add(companyField);
	}
}
